package com.anda.account.domain.model.cash;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.anda.account.domain.model.inventory.Customer;
import com.anda.account.domain.model.inventory.Inventory;
import com.anda.account.domain.model.inventory.Supplier;

/**
 * 资金流水
 * @author Administrator
 *
 */
@Entity
public class Cash {

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long cashId; 
	
	private String businessCode;            //业务编号        
	private Date businessDate;              //业务日期
	private String summary;                 //摘要
	private Float revenue;					//收入 	
	private Float expenses;					//支出
	private Float balance;					//结余
	
	@OneToMany(targetEntity=Inventory.class,fetch=FetchType.LAZY)
	private List<Inventory> inventorys = new ArrayList<Inventory>();//库存流水(进货或者销售)
	
	@ManyToOne(targetEntity=Supplier.class,fetch=FetchType.LAZY)
	@JoinColumn(name="supplierId",referencedColumnName="supplierId")
	private Supplier supplier;          //供应商/欠款
	
	@ManyToOne(targetEntity=Customer.class,fetch=FetchType.LAZY)
	@JoinColumn(name="customerId",referencedColumnName="customerId")
	private Customer customer;          //客户/欠款
	
	@ManyToOne(targetEntity=PayRevCatalog.class,fetch=FetchType.LAZY)
	@JoinColumn(name="payRevCatalogyId",referencedColumnName="itemId")
	private PayRevCatalog payRevCatalogy;//收支项目

	public Long getCashId() {
		return cashId;
	}

	public void setCashId(Long cashId) {
		this.cashId = cashId;
	}

	public List<Inventory> getInventorys() {
		return inventorys;
	}

	public void setInventorys(List<Inventory> inventorys) {
		this.inventorys = inventorys;
	}

	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public PayRevCatalog getPayRevCatalogy() {
		return payRevCatalogy;
	}

	public void setPayRevCatalogy(PayRevCatalog payRevCatalogy) {
		this.payRevCatalogy = payRevCatalogy;
	}

	public String getBusinessCode() {
		return businessCode;
	}

	public void setBusinessCode(String businessCode) {
		this.businessCode = businessCode;
	}

	public Date getBusinessDate() {
		return businessDate;
	}

	public void setBusinessDate(Date businessDate) {
		this.businessDate = businessDate;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public Float getRevenue() {
		return revenue;
	}

	public void setRevenue(Float revenue) {
		this.revenue = revenue;
	}

	public Float getExpenses() {
		return expenses;
	}

	public void setExpenses(Float expenses) {
		this.expenses = expenses;
	}

	public Float getBalance() {
		return balance;
	}

	public void setBalance(Float balance) {
		this.balance = balance;
	}
	
}
